<template>
  <div class="hFull flex column single-select-image-questions-body">
    <div class="radioBg">
      <!-- 题目 -->
      <div class="head">
        <div class="flex headBox aicenter jccenter">
          <div class="tips mr10"></div>
          <div class="equal fz16 overflow-y qtText">
            <span>{{question.guide}}</span>
          </div>
        </div>
      </div>
      <!-- 问题 -->
      <div class="question">
        <div class="fzWhite18" v-for="stem in question.stem_pic" :key="stem">
          <img :src="imgUrl+stem" />
        </div>
      </div>
      <!-- 答案 -->
      <div class="answer">
        <div class="flex aicenter jccenter">
          <div
            class="equal asList pra"
            v-for="opt in question.option_pic"
            :key="opt"
            v-bind:class="{onlink:opt==answer}"
            @click="selectAnswer(opt)"
          >
            <div class="address fzWhite18">
              <img :src="imgUrl+opt" />
            </div>
          </div>
          <div class="submit" @click="submit(answer)"></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["submitAnswer", "question", "imgUrl"],
  data() {
    return {
      answer: null,
    };
  },
  created() {
    console.log(this.question);
  },
  methods: {
    selectAnswer(answer) {
      this.answer = [answer];
    },
    submit(answer) {
      this.answer = null;
      this.submitAnswer(answer);
    },
  },
};
</script>
<style lang="css">
.single-select-image-questions-body {
  width: 100%;
  position: relative;
  background: url(../assets/images/radioBg.png) no-repeat center center;
  background-size: 100% 100%;
}
.head {
  position: absolute;
  top: 0.2rem;
  left: 0;
  right: 0;
  padding: 0 0.5rem;
}
.headBox {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 0.1rem;
  border: 0.1rem solid #fff;
}
.tips {
  width: 0.38rem;
  height: 0.33rem;
  display: block;
  background: url(../assets/images/newsIcon.png) no-repeat;
  background-size: 100%;
}
.question {
  width: 44%;
  position: absolute;
  top: 20%;
  left: 28%;
  bottom: 40%;
  right: 28%;
  text-align: center;
  display: flex;
  justify-content: center;
  flex-direction: column;
  overflow-y: auto;
}
.answer {
   padding: 0;
    position: absolute;
    left: 15%;
    top: 68%;
    bottom: 3%;
    right: 5%;
}
.asList {
    width: 2.51rem;
    height: 2.02rem;
    padding: 0.1rem 0.1rem;
    background: url(../assets/images/txtBg.png) no-repeat center center;
    background-size: 100% 100%;
    margin-right: 1rem;
    text-align: center;
    cursor: pointer;
}
.address {
  position: absolute;
  top: 10%;
  left: 10%;
  bottom: 55%;
  right: 10%;
  padding: 0 0.1rem;
  text-align: center;
  display: flex;
  justify-content: center;
  flex-direction: column;
}
.address > img {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  height: auto;
}
.submit {
  width: 0.98rem;
  height: 0.98rem;
  background: url(../assets/images/submitBtn.png) no-repeat center center;
  background-size: 100% 100%;
  cursor: pointer;
  margin-left: 0.2rem;
}
.asList.onlink {
  background: url(../assets/images/txtBgOn.png) no-repeat center center;
  background-size: 100% 100%;
  margin-right: 1rem;
}
.qtText {
  height: 0.5rem;
  flex-direction: column;
  justify-content: center;
  display: flex;
}
</style>